import 'dart:ui';

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_syt/generated/l10n.dart';
import 'package:flutter_syt/theme/font_styles.dart';
import 'package:flutter_syt/widgets/web_video_page.dart';
// import 'package:webview_flutter/webview_flutter.dart';
import 'package:yyy_route_annotation/yyy_route_annotation.dart';

@RoutePage(name: "articleDetail")
class ArticleDetailPage extends StatefulWidget {
  final String url;

  ArticleDetailPage(this.url);

  @override
  State<StatefulWidget> createState() {
    return _ArticleDetailState();
  }
}

class _ArticleDetailState extends State<ArticleDetailPage> {
  String _title = '';
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(
          S.current.Details_2,
          style: FontStyles.headerTextStyle_18.copyWith(
            fontWeight: FontWeight.w500,
          ),
        ),
        // actions: [
        //   GestureDetector(
        //     onTap: () {
        //       // Share.shareXFiles(files)
        //       // Share.share(
        //       //   'text',
        //       //   subject: 'asdvjas',
        //       // );
        //       // FlutterShare.shareFile(
        //       //     title: 'title',
        //       //     filePath:
        //       //         'https://scrm-file.cdn.buerkongjian.com/file/20230401/f472623b9443cb4aa6d055542ef21e60.png?x-oss-process=image/resize%2Cm_lfit%2Ch_400%2Cw_400');
        //       FlutterShare.share(
        //           // title: '_title',
        //           title: appContext.packageInfo.appName,
        //           linkUrl: widget.url);
        //     },
        //     behavior: HitTestBehavior.opaque,
        //     child: Container(
        //       margin: EdgeInsets.only(right: 15),
        //       child: Image.asset(
        //         'assets/icons/web_share.png',
        //         width: 22,
        //       ),
        //     ),
        //   )
        // ],
      ),
      body: WebVideoPage(
        widget.url,
        needBar: false,
        titleCall: (title) {
          // DLog(_title);
          // if (mounted) {
          //   setState(() {
          _title = title;
          //   });
          // }
        },
      ),
      // body: WebContent(
      //   widget.url,
      //   titleCall: (title) {
      //     if (mounted) {
      //       setState(() {
      //         _title = title;
      //       });
      //     }
      //   },
      // ),
    );
  }
}
